home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Video Toaster 4.0
/
Video Toaster v4.0.iso
/
arexx
/
modeler
/
pathtolwmotion.lwm
< prev
next >
Wrap
Text File
|
1993-12-13
|
2KB
|
84 lines
/* CMD: Path to Motion
* Convert Path in layer to LW Motion file. All points in layer are used,
* in the order they were created (??)
* By Arnie Cachelin © 1993 NewTek Inc.
*/
NUMERIC DIGITS 6
call addlib "LWModelerARexx.port", 0
call addlib "rexxsupport.library", 0, -30, 0
signal on error
signal on syntax
sysnam = 'Path to Motion '
call req_begin sysnam
id_mes = req_addcontrol("Convert path in",'T',"current layer to LW Motion file")
id_frames = req_addcontrol("Frames", 'n')
id_skip1 = req_addcontrol("Skip First Point", 'b')
id_skipn = req_addcontrol("Skip Last Point", 'b')
call req_setval id_frames, 60
if (~req_post()) then do
call req_end
exit
end
frames = req_getval(id_frames) % 1
skip1= req_getval(id_skip1)
skipn= req_getval(id_skipn)
call req_end
File.name=getfilename("-- Save Envelope --","Motions")
if File.name ="(none)" then exit
h=0; p=0; b=0
xsc=1; ysc=1; zsc=1
File.type="LWMO"
n = xfrm_begin()
if (n-skip1-skipn)>frames then frames=n-skip1-skip2
Keys=n-skip1-skipn
KeySpacing=(Frames/Keys)%1+1
call WriteHeader(mot,keys)
do i=1+skip1 to n-skipn
parse value xfrm_getpos(i) with x y z .
k=(i-1-skip1)*keyspacing
call WriteKey(mot,k,0)
end
call xfrm_end
call close mot
call notify(1,'!Created Motion File: 'File.name)
exit
WriteKey: PROCEDURE EXPOSE x y z h p b xsc ysc zsc
arg MotFile, frame, lin
channels=x y z h p b xsc ysc zsc
spline=frame lin "0.0 0.0 0.0"
say channels spline
call writeln(MotFile,channels)
call writeln(MotFile,spline)
return frame
WriteHeader: PROCEDURE EXPOSE File.
arg MotFile, Keys
if open(MotFile,File.name,'W') then do
call writeln(MotFile,File.type)
call writeln(MotFile,"1") /* magic # */
call writeln(MotFile,"9") /* Channels */
call writeln(MotFile,Keys)
end
else do
Bummer("Can't open Motion file : "File.name)
end
return 1
Bummer:
ARG etxt
t=Notify(1,'!Rexx Script Error','@'ETxt)
exit
syntax:
error:
call end_all
t=Notify(1,'!Rexx Script Error','@'ErrorText(rc),'Line 'SIGL)
exit